package com.niuwa.p2p.core.utils;

/**
 * @ClassName: WebUtils
 * @Description: Web工具类
 * @author: zhangbo
 * @date:2015年1月9日 上午9:58:19
 */
public class WebUtils {

	private static String WEBAPP_PATH;

	private static String WEB_CONTEXT;

	private static Integer HTTP_PORT;

	public static String getWebappPath() {
		return WEBAPP_PATH;
	}

	public static void setWebappPath(String path) {
		WEBAPP_PATH = path;
	}

	/**
	 * 获取web应用的http访问路径
	 * 
	 * @return
	 */
	public static String getHttpContext() {
		return WEB_CONTEXT;
	}

	public static void setHttpContext(String cxt) {
		WEB_CONTEXT = cxt;
	}

	/**
	 * 获取web服务器监听端口
	 * 
	 * @return
	 */
	public static Integer getHttpPort() {
		return HTTP_PORT;
	}

	public static void setHttpPort(int port) {
		HTTP_PORT = Integer.valueOf(port);
	}

	public class MediaTypes {

		public static final String APPLICATION_XML = "application/xml";
		public static final String APPLICATION_XML_UTF_8 = "application/xml; charset=UTF-8";

		public static final String JSON = "application/json";
		public static final String JSON_UTF_8 = "application/json; charset=UTF-8";

		public static final String JAVASCRIPT = "application/javascript";
		public static final String JAVASCRIPT_UTF_8 = "application/javascript; charset=UTF-8";

		public static final String APPLICATION_XHTML_XML = "application/xhtml+xml";
		public static final String APPLICATION_XHTML_XML_UTF_8 = "application/xhtml+xml; charset=UTF-8";

		public static final String TEXT_PLAIN = "text/plain";
		public static final String TEXT_PLAIN_UTF_8 = "text/plain; charset=UTF-8";

		public static final String TEXT_XML = "text/xml";
		public static final String TEXT_XML_UTF_8 = "text/xml; charset=UTF-8";

		public static final String TEXT_HTML = "text/html";
		public static final String TEXT_HTML_UTF_8 = "text/html; charset=UTF-8";
	}

}
